package com.bjpowernode.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
public class HelloController {

    @GetMapping(value = "/")
    public String index() {
        return "Hello, Index, Spring Security.";
    }

    @RequestMapping(value = "/api/hello")
    public Object hello(Principal principal) {
        //拿到当前登录人的信息，principal就是当前登录人信息
        return principal;
    }
}
